package com.dpac.core.freemarker.extend;

import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.view.freemarker.FreeMarkerView;

import com.dpac.core.util.LoggerUtils;

/**
 * @title FreeMarkerView的拓展
 * @description 请填写相关描述
 * @creator lils
 * @date 2017年8月17日 下午3:53:28
 */
public class FreeMarkerViewExtend extends FreeMarkerView {

	protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request) {

		try {
			super.exposeHelpers(model, request);
		} catch (Exception e) {
			LoggerUtils.fmtError(FreeMarkerViewExtend.class, e, "FreeMarkerViewExtend 加载父类出现异常。请检查。");
		}
		model.put("contextPath", request.getContextPath());
		model.putAll(Ferrmarker.initMap);
		model.put("_time", new Date().getTime());
		model.put("NOW_YEAY", Calendar.getInstance().get(Calendar.YEAR));// 今年
		model.put("basePath", request.getContextPath());// base目录。
	}
}
